﻿/*********************************************************************************
 *Author:         OnClick
 *Version:        1.0
 *UnityVersion:   2018.3.11f1
 *Date:           2019-04-07
 *Description:    IFramework
 *History:        2018.11--
*********************************************************************************/
using UnityEditor;
using UnityEngine;
namespace IFramework
{
    public partial class ABWindow : IEditorWindow
    {
        [MenuItem("IFramework/AssetBundle/BuildWindow")]
        public static void ShowWindow()
        {
            GetWindow<ABWindow>(false, "AssetBundle", true).minSize=new Vector2(200 + 700, 500);
        }
	}
    public partial class ABWindow : IEditorWindow
    {     
        private Rect windowRect;
        private Rect TopButtonRect;
        private Rect CollectRect;
        private Rect BuildRect;
        private ABWindowTop aBWindowTop = new ABWindowTop();
        private ABCollectWindow collect = new ABCollectWindow();
        private ABBuildWindow build = new ABBuildWindow();

        public static Event Eve;
        public static Vector2 mousePos;
        public static bool IsShowCollect=true;
        private void OnEnable()
        {
            windowRect = this.position;
            TopButtonRect = new Rect(0, 0, windowRect.width, 50);
            BuildRect=CollectRect = new Rect(0, 50, windowRect.width, windowRect.height - 50);
            collect.OnEnable();
            build.OnEnable();
        }
        private void OnGUI()
        {
            windowRect = this.position;
            Eve = Event.current;
            mousePos = Eve.mousePosition;
            CollectRect.width= TopButtonRect.width = windowRect.width;
            CollectRect.height = windowRect.height - 50;
            BuildRect = CollectRect;

            aBWindowTop.OnGUI(TopButtonRect,TopButtonRect);
            if (IsShowCollect)
                collect.OnGUI(CollectRect, CollectRect);
            else
            {
                build.WorldRect = BuildRect;
                build.OnGUI(BuildRect,BuildRect);
            }
        }
       
    }
}
